A structure, such as a struct
, union
or class
that grows too much tends to aggregate too many
responsibilities and inevitably becomes harder to understand and therefore to maintain, and having a lot of fields is an indication that a structure
has grown too large.
Above a specific threshold, it is strongly advised to refactor the structure into smaller ones that focus on well defined topics.
When computing the number of fields in a structure, consecutive bit-fields are counted as a single field: Bit-fields are commonly used to map
external definitions, and the associated complexity only reflects this external system’s intrinsic complexity.